package com.integration.gateway.receiver;

import com.integration.gateway.pojo.Drink;
import com.integration.gateway.pojo.OrderItem;
import lombok.extern.slf4j.Slf4j;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

@Slf4j
@Component
public class Barista {

    @ServiceActivator(inputChannel = "hotDrinkBarista", outputChannel = "preparedDrinks")
    public Drink prepareHotDrink(OrderItem orderItem) {
        log.info("=== prepareHotDrink ===");
        log.info(Thread.currentThread().getName() + " prepared hot drink for order :" + orderItem);
        return new Drink(orderItem);
    }

    @ServiceActivator(inputChannel = "coldDrinkBarista", outputChannel = "preparedDrinks")
    public Drink prepareColdDrink(OrderItem orderItem) {
        log.info("=== coldDrinkBarista ===");
        log.info(Thread.currentThread().getName() + " prepared cold drink for order :" + orderItem);
        return new Drink(orderItem);
    }

}
